from django.shortcuts import render, redirect, reverse

class MyFilter:
    def __init__(self,get_response):
        self.get_response = get_response


    def __call__(self,request):
        request_url = request.build_absolute_uri()
        session = request.session
        response = self.get_response(request)
        if not session.get("user"):
            if request.path == "/article/article_index":
                return redirect("/")
        return response